{extend name="main"}

{block name="button"}
{/block}

{block name="content"}
<div class="think-box-shadow layui-form">
    <div style="margin-left:99px;max-width:750px">
        {foreach ['pilot'=>lang('飞手端小程序'),'merchant'=>lang('商户端小程序')] as $k=>$v}
        <input type="radio" data-wechat-client="{$k}" name="wechat.client" value="{$k}" title="{$v}" lay-filter="wechat_client">
        {/foreach}
        <div class="help-block">需要在微信公众号平台获取到的参数填写到下面</div>
    </div>
</div>
<div class="think-box-shadow margin-top-15">
    <div class="padding-top-20" style="max-width:850px">
        <div class="layui-anim layui-anim-fadein" data-client="pilot">{include file='config/wechat_pilot'}</div>
        <div class="layui-anim layui-anim-fadein" data-client="merchant">{include file='config/wechat_merchant'}</div>
    </div>
</div>
{/block}

{block name='script'}
<script>
    $(function () {
        window.form.on('radio(wechat_client)', apply);
        apply({value: '{:sysconf("wechat.client")}' || 'pilot'});

        function apply(data) {
            this.$active = $("[data-wechat-client='" + data.value + "']").trigger('click');
            if (this.$active.size() < 1) $("[data-wechat-client]:first").trigger('click');
            $('[data-client="' + data.value + '"]').show().siblings('[data-client]').hide();
        }
    });
</script>
{/block}
